cmake_minimum_required(VERSION 3.4)
project(panda_framework)

include_directories(panda)
include_directories(3rd_lib/libuv/include)

add_definitions(-DDEBUG)

if(${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
    add_definitions(-DPANDA_APPLE)
    add_definitions(-DPANDA_IOS)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
    add_definitions(-DPANDA_APPLE)
    add_definitions(-DPANDA_MAC)
else()
    if (WIN32)
    add_definitions(-DPANDA_WIN32)
    add_definitions(-DNOMINMAX)
    elseif (ANDROID)
    add_definitions(-PPANDA_ANDROID)
    elseif (LINUX)
    add_definitions(-DPANDA_LINUX)
    endif()
endif()

#add_definitions(-DDEBUG)

add_definitions("-Wall -g")

set(CMAKE_CXX_STANDARD 17)

file(GLOB_RECURSE SOURCES_HEADER "panda/*.hpp")
file(GLOB_RECURSE SOURCES_FILE   "panda/*.cc")

add_subdirectory(3rd_lib/libuv)

add_library(${PROJECT_NAME}_a STATIC ${SOURCES_FILE})

add_library(${PROJECT_NAME} SHARED ${SOURCES_FILE})

target_link_libraries(${PROJECT_NAME}
    uv)
target_link_libraries(${PROJECT_NAME}_a
    uv_a)

file(GLOB_RECURSE TEST_FILE   "test/*.cc")

# add_definitions(-DPANDA_LIBRARY_IMPL)

add_executable(panda_framework_test ${TEST_FILE})

if (WIN32)
target_link_libraries(panda_framework_test PUBLIC
    ${PROJECT_NAME}_a
    )
else (WIN32)
target_link_libraries(panda_framework_test PUBLIC
    ${PROJECT_NAME} 
    pthread
    )
endif()
# add_subdirectory(test)
